package com.sl.au.service.impl;
/**
 * 合同回款历史服务层实现类1
 * zty
 * 2017-02-20
 */
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.sl.au.entity.Chance;
import com.sl.au.entity.ContractBillInfo;
import com.sl.au.entity.EXDEpayHistoryInfo;
import com.sl.au.repository.EXDEpayHistoyRepository;
import com.sl.au.repository.PaymentSearchForViewRespository;
import com.sl.au.service.EXDEpayHistoryService;
import com.sl.au.service.PaymentSearchForViewService;
@Service("EXDEpayHistoryService")
@Transactional
public class EXDEpayHistoryServiceImpl extends BaseServiceImpl implements EXDEpayHistoryService{

	
	@Autowired
	EXDEpayHistoyRepository exdepayhistoyrepository;
	public EXDEpayHistoyRepository getRepository() {
		return exdepayhistoyrepository;
	}
	
	@Override
	public List<EXDEpayHistoryInfo> getMyPage(int start, int length, String superior, String key) {
		Page<EXDEpayHistoryInfo> pages=null;
		Pageable pageable=new PageRequest(start/length,length,Sort.Direction.DESC,"cdPaidDate");//排序
		if(key != null && !key.equals("")){
			pages=exdepayhistoyrepository.getexdepayHistoryInfo(superior,key,pageable);//注意顺序
		}else{
			pages=exdepayhistoyrepository.getexdepayHistoryInfo(superior,pageable);
		}
		return pages.getContent();
	}
	@Override
	public long getCount(int start, int length, String superior, String key) {
		long pagesCount = 0;
		if(key != null && !key.equals("")){
			pagesCount = exdepayhistoyrepository.getCount(superior,key);//注意顺序
		}else{
			pagesCount = exdepayhistoyrepository.getCount(superior);
		}
		
		return pagesCount;
		
	}

	
}
